package cn.itsource.service.impl;

import cn.itsource.domain.IpAddress;
import cn.itsource.mapper.IpAddressMapper;
import cn.itsource.service.IpAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class IpAddressServiceImpl implements IpAddressService {

    @Autowired
    private IpAddressMapper ipAddressMapper;

    @Override
    public List<IpAddress> findAll() {
        return ipAddressMapper.findAll();
    }

    @Override
    public IpAddress findOne(Long id) {
        return ipAddressMapper.findOne(id);
    }

    @Transactional
    @Override
    public void add(IpAddress ipAddress) {
        ipAddressMapper.add(ipAddress);
    }

    @Transactional
    @Override
    public void update(IpAddress ipAddress) {
        ipAddressMapper.update(ipAddress);
    }

    @Transactional
    @Override
    public void delete(Long id) {
        ipAddressMapper.delete(id);
    }
}
